<?php

namespace App\Transformers;

use App\Models\UserCommission;
use League\Fractal\TransformerAbstract;

class UserCommissionTransformer extends TransformerAbstract
{
    //可进行包含的信息
    protected $availableIncludes = [];

    public function transform(UserCommission $userCommission)
    {
        return [
            'id' => $userCommission->id,
            'user_id' => $userCommission->user_id ?? '',
            'total_amount' => $userCommission->total_amount ?? '',
            'account_amount' => $userCommission->account_amount ?? '',
            'withdrawal_amount' => $userCommission->withdrawal_amount ?? '',
            'remarks' => $userCommission->remarks ?? '',
            'created_at' => $userCommission->created_at ? $userCommission->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $userCommission->updated_at ? $userCommission->updated_at->format("Y-m-d H:i:s") : '',
            'user' => $userCommission->user,
        ];
    }

}
